#include "stdafx.h"
#include "CommandDef.h"
#include "debug_new.h"
#include "Util/UtilInclude.h"
#include "CMSGClubSettingCon.h"
#include "MainMenuPainter.h"
#include "IResCfg.h"
#include "CMSGInforCon.h"
#include "CParentsPainter.h"
#include "cmyreg.h"

CMSGClubSettingCon::CMSGClubSettingCon(HWND hWnd):CMSGInforCon(hWnd)
{
	m_fZoom=1.0;
	m_pSubCon=NULL;
	m_hWnd=hWnd;
	m_TotalTime=0;
	m_TotalDis=0;
	m_TotalRep=0;

}

CMSGClubSettingCon::~CMSGClubSettingCon(void)
{
	if (m_pSubCon)
	{
		delete  m_pSubCon;
		m_pSubCon=NULL;
	}
	
}
 void  CMSGClubSettingCon::OnLButtonDown(UINT nFlags, CPoint point)
 {
     CRect rc=m_pSubCon->GetValidRect();
	 rc.MoveToXY(m_pSubCon->GetRect().TopLeft());

	 if (m_pSubCon&&rc.PtInRect(point))
    {
		m_pSubCon->OnLButtonDown(nFlags, point);
    }
	  else
	CContainer::OnLButtonDown( nFlags,point );
    
 }
 void   CMSGClubSettingCon::OnLButtonUp(UINT nFlags, CPoint point)
 {
	 CRect rc=m_pSubCon->GetValidRect();
	 rc.MoveToXY(m_pSubCon->GetRect().TopLeft());

	 if (m_pSubCon&&rc.PtInRect(point))
	 {
		 m_pSubCon->OnLButtonUp(nFlags, point);
	 }
	 else
	 	CContainer::OnLButtonUp( nFlags,point );
 }
BOOL CMSGClubSettingCon::InitControls(DWORD dwData)
{
	//message box
	LANGUAGE_DECLARE;
	FONT_DECLARE;

	HBITMAP hBitmap = NULL;

	CIResCfg ResCon;
	if(!ResCon.Init(L"MSGClubSet.xml"))
	{
		//g_App.ShowMsgBox(CMD_MSGBOX_OK,L"",LAN_GETTEXT(Msg_ResError));
		return FALSE;
	}

	m_nAniType  = ResCon.GetAniType();
	m_nExitAniType=ResCon.GetExitAniType();
	m_nAniSpeed = ResCon.GetAniSpeed();
	SetRect(ResCon.GetRect());
	BOOL bFromDll = ResCon.IsResFromDll();
	BtnParam btnInfo;

	hBitmap = CUtil::LoadBitmapEx(ResCon.GetImage(),bFromDll);
   	this->SetMaskBmp(hBitmap);

	BatTimePicParam picInfo;
	ResCon.GetBatTimePicParam(picInfo,L"Pic_Bkgnd");
	CPicture *pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC, L"OK",picInfo.m_rc, CMD_MSGBOX_PIC));
	ResCon.SetPicParam(pPic,picInfo);

	TextParam txtInfo;
	CText* pText=NULL; 

	//if(m_strCaption.size()>0)
	//{
	ResCon.GetTextParam(txtInfo,L"Title");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_TITLE),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);
	//}
	CBmpBtn* pBtn = NULL;
	ResCon.GetBtnParam(btnInfo,L"Btn_Defult");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(CM_DEFUALT),btnInfo.m_rc, CMD_MSG_CLUBSET_DEFAULT));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"Btn_Save");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(CM_SVAE),btnInfo.m_rc, CMD_MSGBOX_CLUBSET_SAVE));
	ResCon.SetBtnParam(pBtn,btnInfo);
	pBtn->Enable(false);

	ResCon.GetBtnParam(btnInfo,L"Btn_No");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(TXT_CANCLE),btnInfo.m_rc, CMD_MSG_CLUBSET_CANCLE));
	ResCon.SetBtnParam(pBtn,btnInfo);



	//ResCon.GetBatTimePicParam(picInfo,L"ClubSet_LanBK");
	//pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC,L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	//ResCon.SetPicParam(pPic,picInfo);

	//ResCon.GetBatTimePicParam(picInfo,L"ClubSet_Unit");
	//pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC,L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	//ResCon.SetPicParam(pPic,picInfo);

	//ResCon.GetBatTimePicParam(picInfo,L"ClubSet_NumberBK1");
	//pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC,L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	//ResCon.SetPicParam(pPic,picInfo);

	//ResCon.GetBatTimePicParam(picInfo,L"ClubSet_NumberBK2");
	//pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC,L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	//ResCon.SetPicParam(pPic,picInfo);


	//ResCon.GetBatTimePicParam(picInfo,L"LangIcon");
	//pPic = (CPicture*)AddControl(new CPicture(SWS_STATIC,L"",picInfo.m_rc, CMD_MSGBOX_PIC));
	//ResCon.SetPicParam(pPic,picInfo);

	//ResCon.GetTextParam(txtInfo,L"CText_LAN");
	//pText = (CText*)AddControl(new CText(SWS_STATICTEXT,LAN_GETTEXT(MSG_HS_CLUBSETTING_DEFAULTLAN),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	//ResCon.SetTextParam(pText,txtInfo);

	//ResCon.GetTextParam(txtInfo,L"CText_UNIT");
	//pText = (CText*)AddControl(new CText(SWS_STATICTEXT,LAN_GETTEXT(MSG_HS_CLUBSETTING_DEFAULTUNIT),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	//ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOTAL");
	pText = (CText*)AddControl(new CText(SWS_STATICTEXT,LAN_GETTEXT(MSG_HS_CLUBSETTING_SUBTOAL),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);

	ResCon.GetTextParam(txtInfo,L"CText_RESET");
	pText = (CText*)AddControl(new CText(SWS_STATICTEXT,LAN_GETTEXT(CM_RESET),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_TIME");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_TIMELONG),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_DISTANCE");
	
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_DISTANCELOG),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	//pText = (CText*)AddControl(new CText(SWS_STATIC,,txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_REP");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_REPETITIONLOG),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);




      DWORD dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubTotalTime");
	  m_TotalTime=dwValue;
   TCHAR szValue[128]={0};
   swprintf(szValue,L"%02d:%02d",dwValue/60,dwValue%60);
	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_TIME_VALUE");
	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_DISTANCE_VALUE");
	dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubTotalDis");
   m_TotalDis=dwValue;
	swprintf(szValue,L"%.1f",(float)dwValue/10.0);

	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME_DIS));
	//pText = (CText*)AddControl(new CText(SWS_STATIC,,txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_SUBTOATL_REP_VALUE");
	dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubTotalRep");
    m_TotalRep=dwValue;
	swprintf(szValue,L"%d",dwValue);
	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME_REP));
	ResCon.SetTextParam(pText,txtInfo);



	/*ResCon.GetBtnParam(btnInfo,L"ClubSet_LAN_BTN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_LAN));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"ClubSet_CHOOSE_BTN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSGBOX_HSNO));
	ResCon.SetBtnParam(pBtn,btnInfo);


	ResCon.GetBtnParam(btnInfo,L"ClubSet_NUM1_BTN_LEFT");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSGBOX_HSNO));
	ResCon.SetBtnParam(pBtn,btnInfo);



	ResCon.GetBtnParam(btnInfo,L"ClubSet_NUM1_BTN_RIGHT");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSGBOX_HSNO));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"ClubSet_NUM2_BTN_LEFT");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSGBOX_HSNO));
	ResCon.SetBtnParam(pBtn,btnInfo);


	ResCon.GetBtnParam(btnInfo,L"ClubSet_NUM2_BTN_RIGHT");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSGBOX_HSNO));
	ResCon.SetBtnParam(pBtn,btnInfo);
*/


	ResCon.GetBtnParam(btnInfo,L"ClubSet_PAGE_BTN_DOWN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTNDOWN));
	ResCon.SetBtnParam(pBtn,btnInfo);


	ResCon.GetBtnParam(btnInfo,L"ClubSet_NUM2_BTN_UP");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTNUP));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"ClubSet_SUBTOATL_TIME_BTN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTN_TOTALTIME));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetBtnParam(btnInfo,L"ClubSet_SUBTOATL_DIS_BTN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTN_DISTANCE));
	ResCon.SetBtnParam(pBtn,btnInfo);


	ResCon.GetBtnParam(btnInfo,L"ClubSet_SUBTOATL_REP_BTN");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTN_REP));
	ResCon.SetBtnParam(pBtn,btnInfo);

	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_LIFETOTAL),txtInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME));
	ResCon.SetTextParam(pText,txtInfo);

	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_TIME");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_TIMELONG),txtInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME_DIS));
	ResCon.SetTextParam(pText,txtInfo);

	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_DISTANCE");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_DISTANCELOG),txtInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME_REP));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_REP");
	pText = (CText*)AddControl(new CText(SWS_STATIC,LAN_GETTEXT(MSG_HS_CLUBSETTING_REPETITIONLOG),txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);




	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_TIME_VALUE");

	dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubLifeTime");

     
	  swprintf(szValue,L"%02d:%02d:%02d",dwValue/3600, (dwValue%3600)/60,(dwValue%3600)%60);
	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);

	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_DISTANCE_VALUE");
	dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubLifeDis");

	swprintf(szValue,L"%.1f",(float)dwValue/10.0);
	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);


	ResCon.GetTextParam(txtInfo,L"CText_LIFETOTAL_REP_VALUE");
	dwValue=CConfig::GetInstance()->GetRegDWORD(L"SubLifeRep");
	swprintf(szValue,L"%d",dwValue);
	pText = (CText*)AddControl(new CText(SWS_STATIC,szValue,txtInfo.m_rc, CMD_MSGBOX_TEXT));
	ResCon.SetTextParam(pText,txtInfo);



	ResCon.GetBtnParam(btnInfo,L"ClubSet_Bright_Left");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTN_BRIGHTDOWN));
	ResCon.SetBtnParam(pBtn,btnInfo);


	ResCon.GetBtnParam(btnInfo,L"ClubSet_Bright_Right");
	pBtn = (CBmpBtn*)AddControl(new CBmpBtn(SBS_RECT,L"",btnInfo.m_rc, CMD_MSG_CLUBSET_BTN_BRIGHTUP));
	ResCon.SetBtnParam(pBtn,btnInfo);
    ProgressParam proInfo;	
	
	ResCon.GetProgreeParam(proInfo,L"ClubSet_Bright_Slider");
	m_pProgress = (CProgress*)AddControl(new CProgress(SBS_RECT, L"", proInfo.m_rc, CMD_MSG_CLUBSET_BTN_BRIGHTSLIDER));
	ResCon.SetProgressParam(m_pProgress,proInfo);

	m_pProgress->SetRange(0,10);
	// CConfig::GetInstance()->GET(TEXT("Backlight"),m_pProgress->GetPos());
	 m_pProgress->SetPos(CConfig::GetInstance()->GetRegDWORD(TEXT("Backlight")));
	

	/*CNumberCtrl* m_psubTotalTimeDis;
	CNumberCtrl* m_psubTotalTimeRep;
	CNumberCtrl* m_psubLifeTime;
	CNumberCtrl* m_psubLifeTimeDis;
	CNumberCtrl* m_psubLifeTimeRep;
    IBmpNumInfo btpInfo;

	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_SUBTOATL_TIME");
	m_psubTotalTime = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME));
	ResCon.SetBmpNumParam(m_psubTotalTime,btpInfo);

	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_DISTANCE_TIME");
	m_psubTotalTimeDis = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME_DIS));
	ResCon.SetBmpNumParam(m_psubTotalTimeDis,btpInfo);

	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_REP_TIME");
	m_psubTotalTimeRep = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_TOTALTIME_REP));
	ResCon.SetBmpNumParam(m_psubTotalTimeRep,btpInfo);




	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_LIFETOTAL_TIME");
	m_psubLifeTime = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME));
	ResCon.SetBmpNumParam(m_psubLifeTime,btpInfo);

	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_LIFETOTAL_DISTANCE");
	m_psubLifeTimeDis = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME_DIS));
	ResCon.SetBmpNumParam(m_psubLifeTimeDis,btpInfo);

	ResCon.LoadIBmpNumParam(btpInfo,L"Count_Ctrl_LIFETOTAL_REP");
	m_psubLifeTimeRep = (CNumberCtrl*)AddControl(new CNumberCtrl(SBS_RECT, L"", btpInfo.m_rc, CMD_MSG_CLUBSET_LIFETIME_REP));
	ResCon.SetBmpNumParam(m_psubLifeTimeRep,btpInfo);*/



	m_pSubCon=new CSubClubSetCon(m_hWnd);
	m_pSubCon->InitControls(0);

	SetPainter(new CParentsPainter());
	return true;
}

void CMSGClubSettingCon::ReLoadConfig()
{
	
	m_pProgress->SetPos(CConfig::GetInstance()->GetBackLight());
	m_pSubCon->ReLoadConfig();



}
void  CMSGClubSettingCon::ChangeLanguage()
{
	m_pSubCon->ChangeLangaue();

   
	


}
void CMSGClubSettingCon::IsModify(UINT msg)
{
     switch (msg)
	 {
	 case CMD_MSG_CLUBSET_BTN_BRIGHTDOWN:
	 case CMD_MSG_CLUBSET_BTN_BRIGHTUP:
	 case CMD_MSG_CLUBSET_BTN_BRIGHTSLIDER:		 	
	 case CMD_MSG_CLUBSET_BTN_REP:
	 case CMD_MSG_CLUBSET_BTN_TOTALTIME:
	 case  CMD_MSG_CLUBSET_BTN_DISTANCE:
	 case  CMD_MSG_SUBSET_BTN_MAXTIME_LEFT:
	 case CMD_MSG_SUBSET_BTN_MAXTIME_RIGHT:
	 case CMD_MSG_SUBSET_BTN_PAUSETIME_LEFT:
	 case CMD_MSG_SUBSET_BTN_PAUSETIME_RIGHT:
	 case CMD_MSG_CLUBSET_BTN_KAYA:
	 case  CMD_MSG_SUBSET_BTN_UNIT:
	 case CMD_MSG_CLUBSET_BTN_CSAFE:
		 {
            CBmpBtn *pBtn= (CBmpBtn *)ControlFromID(CMD_MSGBOX_CLUBSET_SAVE);
			pBtn->Enable(true);
			InvalidateRect(m_hWnd,pBtn->GetRect(),NULL);

		 }
	
		 break;
	
}
void CMSGClubSettingCon::SaveConfig()
{

 // CConfig::GetInstance()->SetBackLight(m_pProgress->GetPos());
  CConfig::GetInstance()->SetRegDWORD(TEXT("Backlight"),m_pProgress->GetPos());
  m_pSubCon->SaveConfig();


   CConfig::GetInstance()->SetRegDWORD(L"SubTotalDis",m_TotalDis);
   CConfig::GetInstance()->SetRegDWORD(L"SubTotalTime",m_TotalTime);
   CConfig::GetInstance()->SetRegDWORD(L"SubTotalRep",m_TotalRep);
}
void CMSGClubSettingCon::OnCommand(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
 {

	 switch (wParam)
	 {
	 case CMD_MSG_CLUBSET_BTN_BRIGHTDOWN:
		 m_pProgress->SetPos(m_pProgress->GetPos()-1);
		 CConfig::GetInstance()->SetBackLight(m_pProgress->GetPos());
		  InvalidateRect(m_hWnd,m_pProgress->GetRect(),FALSE);
		 break;
	 case CMD_MSG_CLUBSET_BTN_BRIGHTUP:
		 m_pProgress->SetPos(m_pProgress->GetPos()+1);
		  CConfig::GetInstance()->SetBackLight(m_pProgress->GetPos());
		  InvalidateRect(m_hWnd,m_pProgress->GetRect(),FALSE);
		 break;
	 case CMD_MSG_CLUBSET_BTN_BRIGHTSLIDER:		 
		 {
			 CConfig::GetInstance()->SetBackLight(m_pProgress->GetPos());
			 InvalidateRect(m_hWnd,m_pProgress->GetRect(),FALSE);
		 }
		 break;
	 case CMD_MSG_CLUBSET_BTN_REP:
		 {
			 CText  *pText=(CText*)ControlFromID(CMD_MSG_CLUBSET_TOTALTIME_REP);
			 pText->SetCaption(L"0");
		
			  m_TotalRep=0;
			
			  InvalidateRect(m_hWnd,pText->GetRect(),FALSE);
		 }
		 break;
	 case CMD_MSG_CLUBSET_BTN_TOTALTIME:

		 {
			 m_TotalTime=0;
		
			 CText  *pText=(CText*)ControlFromID(CMD_MSG_CLUBSET_TOTALTIME);
			 pText->SetCaption(L"00:00");
			
		     InvalidateRect(m_hWnd,pText->GetRect(),FALSE);
		 }
		// m_psubTotalTimeRep->SetDigitCount(1);
		// m_psubTotalTimeDis->SetValue(0);
		 break;


	 case  CMD_MSG_CLUBSET_BTN_DISTANCE:
		 {
			 m_TotalDis=0;
		
			 CText  *pText=(CText*)ControlFromID(CMD_MSG_CLUBSET_TOTALTIME_DIS);
			 pText->SetCaption(L"0.0");
			 
			   InvalidateRect(m_hWnd,pText->GetRect(),FALSE);
		 }
		 break;

	 }
	
	 m_pSubCon->OnCommand(hWnd,wMsg, wParam,  lParam);
	
 }
